import axios from 'axios'

export function getHotSongs(){
   return  axios.get('/reptile/GetMusicHotSongs')
}


//传入多个音乐，传出数组url
export function getSongsDetail(songmids){
    //https://api.zsfmyz.top/music/song?songmid=004WEUNX37kLL8&guid=126548448
    //执行多个promise https://blog.csdn.net/u014452812/article/details/100561764
    let promiseList=[];
    songmids.map(a=>{//遍历数据操作
        promiseList.push(
            getSongDetail(a).then(res=>{
                let url=res.data[0].m4aUrl;
                if(url!="https://ws.stream.qqmusic.qq.com/"){
                    return res.data[0];
                }
                    
            })
        );
    });
    return Promise.all(promiseList);
}


export function getSongDetail(songmid){
    return  axios.get('/reptile/GetMusicDetail?mid='+songmid)
}

export function getSongComments(songid){
//https://c.y.qq.com/base/fcgi-bin/fcg_global_comment_h5.fcg?cid=205360772&biztype=1&topid=281515301&cmd=8
    return  axios.get('/reptile/GetMusicComments?songID='+songid)
}

export function getLyric(mid){
    return axios.get('/reptile/GetMusicLyric?mid='+mid);
}
export function downFile(mid){
    return  axios.get('/reptile/DownMusicFile?mid='+mid)
}

